package com.ostrich.module_home.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import androidx.viewpager2.adapter.FragmentStateAdapter

/**
 * @Author : yaotianxue
 * @Time : On 2023/10/27 11:02
 * @Description : HomeFragmentAdapter
 */
class HomeFragmentAdapter(val titles:MutableList<String>,
                          private val fragments:MutableList<Fragment>, private val fm:FragmentManager):FragmentStatePagerAdapter(fm) {
    override fun getCount(): Int {
        return fragments.size
    }

    override fun getItem(position: Int): Fragment {
        return fragments[position]
    }

    override fun getPageTitle(position: Int): CharSequence? {
        return titles[position]
    }
}